#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <set>
using namespace std;

class Solution
{
public:
    int removeDuplicates(vector<int> &nums)
    {
        int fast = 0, slow = 0;
        for (; fast < nums.size(); ++fast)
        {
            if (nums[slow] != nums[fast])
                nums[++slow] = nums[fast];
        }
        return slow+1;
    }
};